package com.woniuxy.controller;

import com.woniuxy.entity.RbacManager;
import com.woniuxy.entity.ResponseEntity;
import com.woniuxy.service.RbacManagerService;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: 马宇航
 * @Todo: 用户管理controller层
 * @DateTime: 22/02/21/0021 上午 11:48
 * @Component: 成都蜗牛学苑
 **/
@RestController
@RequestMapping("/rbacManager")
public class RbacManagerController {
    @Autowired(required = false)
    RbacManagerService rbacManagerService;
    @PostMapping("/findAll/{currentPage}/{pageSize}")
    @RequiresPermissions("user_manage")
    public ResponseEntity findAll(@PathVariable("currentPage") int currentPage,@PathVariable("pageSize") int pageSize,@RequestBody RbacManager rbacManager){
       return rbacManagerService.findAll(currentPage,pageSize,rbacManager);
    }
    @DeleteMapping("/deleteOne/{id}")
    public ResponseEntity deleteOne(@PathVariable int id){
       return rbacManagerService.deleteOne(id);
    }
    @RequestMapping("/addOne")
    public ResponseEntity addOne(@RequestBody RbacManager rbacManager){
        return rbacManagerService.addOne(rbacManager);
    }

}
